// 快捷键：rfc
import React from 'react'
import {NavLink,useRoutes,useInRouterContext} from "react-router-dom"
import routers from './routers'
import Header from './components/Header'

export default function App() {
  const element = useRoutes(routers)
  console.log(useInRouterContext());
  return (
    <div>
      <div className="row">
        <Header />
      </div>
      <div className="row">
        <div className="col-xs-2 col-xs-offset-2">
          <div className="list-group">
            {/* 路由链接 */}
            <NavLink className={({isActive})=>isActive? "list-group-item box":"list-group-item"} to="about"> 
              About
            </NavLink>
            {/* <NavLink className="list-group-item" to="/about">
              About
            </NavLink> */}
            <div>-----</div>  
            <NavLink className={({isActive})=>isActive? "list-group-item box":"list-group-item"} to="home">
              Home
            </NavLink>
            <div>-----</div>
          </div>
        </div>
        <div className="col-xs-6">
          <div className="panel">
            <div className="panel-body">
              {/* 注册路由 */}
              {element}
              {/* <Routes>
                <Route path='/about' element={<About />}/>
                <Route path='/home' element={<Home />}/>
                <Route path='/' element={<Navigate to="/about" />}/>
              </Routes> */}
            </div>
          </div>
        </div>
      </div>
    </div>
  )
}
